#!/bin/bash

#################################################
#    <        SYNAPiTC MANAGER        >        #  
#    contact: sonymath [at] zoho [dot] com    #
#                                              #
#           OPEN SOURCE SOFTWARE, BITCH        #
#        GET OVER WINDOWS, USE GNU/LINUX!      #
#################################################

if test $(id -u) != 0
then                 
    echo "Error [1]: You need to be root"
    exit 0                     
fi 


        if [ "$(echo "$*" | grep -e --help)" != "" ]
        then
            echo "Example: ./synapticmanager --install amarok

--update
--remove
--install
"
	exit 0
	fi



        if [ "$(echo "$*" | grep -e --install)" != "" ]
        then
            echo "$*" | sed 's/$/\ /;s/--install //' | sed 's/\ /\ install\r\n/g' > /tmp/synapticmanager$$
	    synaptic --set-selections --non-interactive --hide-main-window < /tmp/synapticmanager$$
        fi



        if [ "$(echo "$*" | grep -e --remove)" != "" ]
        then
            echo "$*" | sed 's/$/\ /;s/--remove //' | sed 's/\ /\ uninstall\r\n/g' > /tmp/synapticmanager$$
	    synaptic --set-selections --non-interactive --hide-main-window < /tmp/synapticmanager$$
        fi


        if [ "$(echo "$*" | grep -e --update)" != "" ]
        then
            synaptic --non-interactive --hide-main-window --update-at-startup
        fi


